<template>
    <p>Axiostest页</p>
    <button @click="getData">获取学生数据</button>
    <table>
          <tr>
            <th>学号</th>
            <th>姓名</th>
            <th>性别</th>
            <th>分数</th>
          </tr>
          <tr v-for="item in students">
            <td>{{ item.id }}</td>
            <td>{{ item.name }}</td>
            <td>{{ item.sex }}</td>
            <td>{{ item.score }}</td>
          </tr>
    </table>
</template>


<script>
  export default{
    data(){
        return{
            students:[]
        }
    },
    methods:{
        getData(){
            this.$http
            .get('http://localhost:3000/stundents')
            .then(res =>{
                console.log(res);
                this.students = res.data
            })
        }
    }
  }
</script>